package com.hashbee.bbs.controller;

import com.hashbee.bbs.domain.Category;
import com.hashbee.bbs.service.CategoryService;
import com.hashbee.bo.ReturnData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/bbs/post/category")
public class CategoryController {

    private static final Logger logger = LoggerFactory.getLogger(CategoryController.class);

    @Autowired
    private CategoryService categoryService;

    @GetMapping("/list")
    public ReturnData list() {

        ReturnData<List<Category>> returnData = new ReturnData<>();

        returnData.setData(categoryService.queryList());

        return returnData;
    }
}
